package com.stoken.service.impl;

import java.text.ParseException;
import java.util.Date;

import org.quartz.CronTrigger;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.SimpleTrigger;
import org.quartz.TriggerUtils;
import org.quartz.impl.StdSchedulerFactory;

public class TestQuartz {
	
	public static void main(String[] args) {
SchedulerFactory sf  = new StdSchedulerFactory();
		
		
		try {			
			Scheduler sched = sf.getScheduler();
			/*JobDetail job = new JobDetail("caculationHitJob", "caculationJobGroup", CalculationHitJob.class);
			CronTrigger trigger = new CronTrigger("trigger1", "caculationJobGroup", "caculationHitJob", "caculationHitJob", "0/20 * * * * ?");
*/
			JobDetail honusJob = new JobDetail("job1", "group1", CalculationHitJob.class);
			CronTrigger honusTrigger = new CronTrigger("trigger1", "group1", "job1", "group1", "0 0/1 * * * ?");
			
			JobDetail systemJob = new JobDetail("job2", "group2", SystemInitJob.class);
			CronTrigger systemTrigger = new CronTrigger("trigger2", "group2", "job2", "group2", "0 0 1 * ?");
            
			sched.scheduleJob(systemJob, systemTrigger);
			sched.scheduleJob(honusJob, honusTrigger);
			sched.start();

		} catch (SchedulerException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
